from PyCmpltrtok.common import dl2ld, ld2dl

"""
dl2ld
d: dict
l: list
dl: dict of list

{
    'a': [1, 2, 3],
    'b': [4, 5, 6],
}

ld: list of dict

[
    {'a': 1, 'b': 4},
    {'a': 2, 'b': 5},
    {'a': 3, 'b': 6},
]

"""
xdict = {
    'a': [1, 2, 3],
    'b': [4, 5, 6],
}
xlist = dl2ld(xdict)
print(xlist)

# xresult = ld2dl(xlist)
# print(xresult)

# [dict(zip(dl, t)) for t in zip(*dl.values())]
v = xdict.values()  # [[1, 2, 3], [4, 5, 6]]
print(*v)
print(list(zip(*v)))
print([dict(zip(xdict, t)) for t in zip(*v)])
